/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.senac.maisconhecimento.servlet;

import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Marcus Lemos
 */
@WebServlet(name = "BaseServlet", urlPatterns = {"/BaseServlet"})
public class BaseServlet extends HttpServlet {

    protected void VerificarLoginRealizado(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        HttpSession sessionRequest = request.getSession();
        Object objEmSessao = sessionRequest.getAttribute("usuarioLogado");
        
        if(objEmSessao == null) {
            RequestDispatcher rd = request.getRequestDispatcher("acesso/Login.jsp");
            rd.forward(request, response);
        }
    }
}